﻿package main

import (
	"fmt"
	"mindonmap/pkgs/setting"
	"mindonmap/routers"
	"net/http"
)

func main() {
	router := routers.InitRouter()
	HTTPPort := setting.GetHttpPort()
	ReadTimeout := setting.GetReadTimeout()
	WriteTimeout := setting.GetWriteTimeout()

	s := &http.Server{
		Addr:           fmt.Sprintf(":%d", HTTPPort),
		Handler:        router,
		ReadTimeout:    ReadTimeout,
		WriteTimeout:   WriteTimeout,
		MaxHeaderBytes: 1 << 20,
	}
	err := s.ListenAndServe()
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	// 使用 Serve 代替 ListenAndServe

}
